package org.jeecg.modules.util;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author Administrator
 */
@Component
@Service
public class CommonUtil {

    // 硬件车桩编号使用整形，后台在整形前加0使用字符
    public static String switchPileCode(String pileCode) {
        Integer pileInt = Integer.valueOf(pileCode);
        if(pileInt<10){
            pileCode = "0" + pileInt.toString();
        }
        return pileCode;
    }

    /*计算业务请求时间差(秒)*/
    public static double calculateSpendTime(long startTime, long endTime) {
        //耗时(秒)
        double spendTime = new BigDecimal(endTime-startTime).divide(new BigDecimal(1000)).doubleValue();
        return spendTime;
    }

}
